/**
 * $Id: TestMain.java,v 1.0 2022/6/6 19:22 shidesheng Exp $
 * <p>
 * Copyright 2021 Sinosoft Co.,Ltd. All rights reserved.
 */
package sds.mode.prototype.deep;

import java.util.ArrayList;
import java.util.List;

/**
 * @author shidesheng
 * @version $Id: TestMain.java,v 1.1 2022/6/6 19:22 shidesheng Exp $
 * Created on 2022/6/6 19:22
 */
public class TestMain {

	public static void main(String[] args) {
		// 原型对象
		ConcretePrototype concretePrototype = new ConcretePrototype();
		concretePrototype.setAge(18);
		concretePrototype.setName("xiaoming");
		List<String> list = new ArrayList<String>();
		list.add("读书");
		list.add("书法");
		concretePrototype.setHobbies(list);
		// 克隆对象 --> 本地克隆（Object的克隆方法）
		//ConcretePrototype clone = concretePrototype.clone();
		ConcretePrototype clone = concretePrototype.deepClone();
		clone.getHobbies().add("羽毛球");
		System.out.println(concretePrototype);
		System.out.println(clone);
	}
}
